package cn.zymall.order.service;

import cn.zymall.common.model.Order;
import com.baomidou.mybatisplus.extension.service.IService;
import com.github.pagehelper.PageInfo;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @program: mall
 * @description: 订单业务层接口
 * @author: YueNiao
 * @email: 1486617253@qq.com
 * @create: 2020-08-17 22:05
 **/

public interface OrderService extends IService<Order> {
	/**
	 * 创建订单
	 * @param order
	 * @return
	 */
	public Order decrementProductStore(Order order);

	/**
	 * 初始订单放入redis中，未支付30分钟过期
	 * @param order
	 */
	public boolean redisDecrementOroduct(Order order);
	/**
	 * 调用支付
	 * @param request
	 * @param response
	 * @param order
	 * @return
	 * @throws IOException
	 */
	public boolean orderPay(HttpServletRequest request, HttpServletResponse response, Order order) throws IOException;

	/**
	 * 动态查询订单
	 * @param userId
	 * @param orderStatus
	 * @return
	 */
	PageInfo<Order> queryOrder(String userId, String orderStatus,int page ,int rows);

	/**
	 * 模糊查询
	 * @param userId
	 * @param orderStatus
	 * @param value
	 * @param page
	 * @param rows
	 * @return
	 */
	PageInfo<Order> dimQueryOrder(String userId,String orderStatus,String value, int page ,int rows);

	/**
	 * 商家订单查询
	 * @param merchantId
	 * @param orderStatus
	 * @param page
	 * @param rows
	 * @return
	 */
	PageInfo<Order> merchantQueryOrder(String merchantId, String orderStatus, int page, int rows);

	/**
	 * 店家模糊查询
	 * @param merchantId
	 * @param orderStatus
	 * @param value
	 * @param page
	 * @param rows
	 * @return
	 */
	PageInfo<Order> dimMerchantQueryOrder(String merchantId, String orderStatus, String value, int page, int rows);
}
